package cn.bm.web.controllers;

import cn.bm.web.controllers.user.UserController;
import spark.Route;

import static spark.Spark.before;

public final class RouteMain {

    public static void InitSiteRoutes(){
        /**
         * 保护app开头的连接
         */
        before("/app/*", (req, res) -> {
            String username = req.session().attribute("username");
            if(username == null){
                System.out.println("未登陆");
                res.redirect("/login.html");

            }
            System.out.println("已登陆");

        });
        UserController.InitRoutes();


    }
    public static void main(String[] args) {

    }
}
